package com.kvest.service_test_client;

import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.util.Log;
import android.view.View;

public class ServiceTestClientActivity extends Activity {
    private static final String COMMAND_ID = "command_id";
    private static final String COMMAND_PARAM = "command_param";
    /**
     * Called when the activity is first created.
     */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }

    public void onStartMainClick(View view) {
//        Intent i = new Intent();
//        PackageManager manager = getPackageManager();
//        i = manager.getLaunchIntentForPackage("com.kvest.service_test");
//        i.addCategory(Intent.CATEGORY_LAUNCHER);
//        startActivity(i);

        Intent intent = new Intent();
        intent.setComponent(new ComponentName("com.kvest.service_test", "com.kvest.service_test.ServiceTestActivity"));
        startActivity(intent);
    }

    public void onStartServiceClick(View view) {
        Intent intent = new Intent("com.kvest.service_test.service.TestService");
        intent.putExtra(COMMAND_ID, 1);
        intent.putExtra(COMMAND_PARAM, "param from another");
        startService(intent);
    }

    public void onStart1Click(View view) {
        Intent intent = new Intent("com.kvest.service_test.intent.action.start_service");
        startActivity(intent);
    }

    public void onStart2Click(View view) {
        Intent intent = new Intent("com.kvest.service_test.intent.action.start_second");
        startActivity(intent);
    }
}
